/* ************************************************************************ */
/*                                                                          */
/*  Copyright (c)2005 Russell Weir | damonsbane _at_ gmail                  */
/*                                                                          */
/* This library is free software; you can redistribute it and/or            */
/* modify it under the terms of the GNU Lesser General Public               */
/* License as published by the Free Software Foundation; either             */
/* version 3.0 of the License, or (at your option) any later version.       */
/*                                                                          */
/* This library is distributed in the hope that it will be useful,          */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        */
/* Lesser General Public License or the LICENSE file for more details.      */
/*                                                                          */
/* ************************************************************************ */

package tzparser;
import altdate.TimeSpecification;
import altdate.DaySpecification;

class Until {
	public var year : Int;	// 'only' as same as from
	public var month : Int;	// month rule takes effect, base 0
	public var onDay : DaySpecification;
	public var atTime : TimeSpecification;

	public function new() {
		year = 0;
		month = 0;
		onDay = new DaySpecification();
		atTime = new TimeSpecification();
	}

	/**
		Returns a JulianDay value for this time on a specific,
		given the location's utcOffset and Standard Time offset.
	*/
	public function toJulianDay(
			utcOffset:TimeSpecification,
			stdOffset:TimeSpecification
		) : altdate.JulianDay
	{
		var day = onDay.getValue(year, month);
		return atTime.toJulianDay(year,month,day,utcOffset,stdOffset);
	}
}